#include "../../inc/my_sqlite3.h"
#define LEN 40
char* input_string(char *pout,int size);
int main(int argc,char * argv[])
{
    char name[LEN] = "";
    char pass[LEN] = "";
    sqlite3* pdb = NULL;
    char filename[LEN] = "diotol.db";
    pdb = create_db_engine(filename);
    char *result = NULL;
    
    printf("please input name\n");
    input_string(name,LEN);
    printf("please input word\n");
    input_string(pass,LEN);
    //register_new_user(pdb,name,pass);    
    //update_login_flag(pdb,name,0);
    //user_login(pdb,name,pass);
    //update_login_flag(pdb,name,0);
    //destory_db_engine(pdb);
    //insert_or_update_history_record(pdb,name,pass);
    result = get_all_history_record_by_username(pdb,name);
    printf("%s\n",result);
}

char* input_string(char *pout,int size)
{
    int cnt = 0;
    char ch = '\0';
    ch = getchar();
    while(ch!='\n')
    {
	*(pout+cnt) = ch;
	cnt++;
	if(cnt>=size-1)
	{
	    break;    
	}
	ch = getchar();
    }
    if(ch!='\n')
    {
	while(getchar()!='\n')
	{
	    
	}
    }
    return pout;
}
